<%-- 
    Document   : formAjoutFicheVoeux
    Created on : 28 mars 2013, 11:13:30
    Author     : ali
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.ArrayList"%>
<%@page import="EDT.obj.Intervenant"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                
        <title>Fiche de  voeux intervenant</title>
            <link rel="stylesheet" href="Accueil.css" />
            <link rel="SHORTCUT ICON" href="./edt.jpg" />
            <link rel="stylesheet" href="calendrier.css" />
    </head>


    <body>    
         
    <section>

        
   <%
    String form ="";
    //ArrayList<Intervenant> intervenant = new ArrayList<Intervenant>();
    
    
        
        //intervenant = EDT.api.API.getAllIntervenant();
        int anneeMax = Integer.parseInt(EDT.api.API.getAnneeMax((String) session.getAttribute("key")));
        
        //session.setAttribute("intervenant", intervenant);
        //form += "<form method='POST' action='AjoutFicheVoeuxAct.do' target='section'>";
     
        form += "<form method='POST' action='AjoutFicheVoeu2.do' target='section'>";
        
        
        form +="<input type='hidden' name='key' value='"+session.getAttribute("key")+"' /><br/><br/><br/><br/>";
        
        
        form +="Intervenant : <input type='hidden' name='interv' value='"
                +session.getAttribute("idinterv")+"'/>"
                +session.getAttribute("prenominterv")+" "
                +session.getAttribute("nominterv")+"<br/><br/>";
        
        /*
        for (Intervenant i : intervenant)
        form +="    <option value='"+i.getId()+"'>"+i.getPrenom()+" "+i.getNom()+"</option>";
        form +="</select><br/><br/>";
        */
        
        DateFormat dateFormat = new SimpleDateFormat("yyyy");
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date()); 
        Integer a =Integer.parseInt(dateFormat.format(cal.getTime()));
        form +="Annee : <select name='annee'>";
        
        for (int i = a ; i< anneeMax; i++)        
            form +="    <option value='"+i+"'>"+i+"/"+(i+1)+"</option>";
        form +="</select><br/><br/>";
        
        
        form +="Periode : <select name='periode'>";            
            form +="    <option value='S1'>Semestre 1</option>";
            form +="    <option value='S2'>Semestre 2</option>";
        form +="</select><br/><br/>";
        
        /*
        cal.setFirstDayOfWeek(6);
        form += "<table class='calendrier calendrier-etroit'> <caption> <span>Les souhaits : </span></caption>";
        
        while (cal.getTime().getDay() != Calendar.SUNDAY)
           cal.add(Calendar.DATE, 1);
        
        DateFormat formater = new SimpleDateFormat("EEEE");
//System.out.println(formater.format(aujourdhui));
        
        DateFormat fullDateFormat = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL);
        for (int i =1; i<= 5; i++){
            form += "<tr><th>Jours</th><th>La periode / jour</th><th>Poids</th></tr>";
            
            form += "<tr><td>"+formater.format(cal.getTime())+"</td>";
            
            form += "<td><input type='radio' name='moment"+i+"' value='3' checked>Toute la journée<br>";
            form += "<input type='radio' name='moment"+i+"' value='1'>le matin<br>";
            form += "<input type='radio' name='moment"+i+"' value='2'>Après midi<br></td>";
            
            
            form += "<td><input type='radio' name='poids"+i+"' value='4' checked>Je le veux<br>";
            form += "<input type='radio' name='poids"+i+"' value='3'>Oui<br>";
            form += "<input type='radio' name='poids"+i+"' value='2'>Possible<br>";
            form += "<input type='radio' name='poids"+i+"' value='1'>Très difficile<br>";
            
            
            form += "<input type='radio' name='poids"+i+"' value='0'>Pas possible<br></td></tr>";
            
            cal.add(Calendar.DATE, 1);
        }
        
            
            form += "</table><br/>";
                       
             */
    
        form +="<input type='submit' value='valider'/><br/>";
        out.println(form);
            
    %>
    
   
    
    
    <html:errors/> 
    
  

    </form>
         
    </section>
    </body>
</html>
